index.html.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <template>
  2. <!-- 页面头部 -->
  3. <HomePageHead></HomePageHead>
  4. <!-- 导航栏 -->
  5. <HomePageNavigation1></HomePageNavigation1>
  6. <!-- 列表页广告一 -->
  7. <HomeTopTen :imgurl="adImg1" v-if="adImg1"></HomeTopTen>
  8. <!-- 面包屑导航 -->
  9. <div class="breadcrumb">
  10. <div class="inner">
  11. <span class="location">当前位置:</span>
  12. <el-breadcrumb :separator-icon="ArrowRight">
  13. <el-breadcrumb-item>
  14. <NuxtLink to="/">首页</NuxtLink>
  15. </el-breadcrumb-item>
  16. <el-breadcrumb-item>
  17. {{ newsDetail.con_title ? newsDetail.con_title : bottomMenu[num]?.name }}
  18. </el-breadcrumb-item>
  19. </el-breadcrumb>
  20. </div>
  21. </div>
  22. <!-- 资讯列表 -->
  23. <div class="newsDetail">
  24. <div class="inner">
  25. <div class="innerDetail">
  26. <div class="headImg"></div>
  27. <div class="innerDetail1">
  28. <div class="leftBottom" v-html="newsDetail.content"></div>
  29. </div>
  30. <div class="footImg"></div>
  31. </div>
  32. <div class="innerLeft">
  33. <ul>
  34. <li>
  35. 导航列表
  36. </li>
  37. <li v-for="(item, index) in bottomMenu" :key="index">
  38. <NuxtLink v-if="item.type == 0" :to="`/about/${item.name_pinyin}/index.html`" :title="item.name"
  39. :class="item.id == pageId ? 'active' : ''">
  40. {{ item.name }}
  41. </NuxtLink>
  42. <NuxtLink v-else-if="item.type == 1" :to="`/about/${item.name_pinyin}/list-1.html`"
  43. :title="item.name" :class="item.id == pageId ? 'active' : ''">
  44. {{ item.name }}
  45. </NuxtLink>
  46. </li>
  47. </ul>
  48. </div>
  49. <div style="clear: both;"></div>
  50. </div>
  51. </div>
  52. <!-- 广告二 -->
  53. <HomeTopTen :imgurl="adImg2" v-if="adImg2"></HomeTopTen>
  54. <!-- 页面底部 -->
  55. <HomeFoot1></HomeFoot1>
  56. </template>
  57. <script setup>
  58. //1.页面依赖 start ---------------------------------------->
  59. import { ElBreadcrumb, ElBreadcrumbItem } from 'element-plus'
  60. import { ArrowRight } from '@element-plus/icons-vue'
  61. import { ref, onMounted } from 'vue';
  62. //获得跳转过来的id
  63. const route = useRoute();
  64. //获得当前的完整路径
  65. const fullPath = route.path;
  66. //拆分,取出来中间这一段,然后提取数字部分
  67. const segments = fullPath.split('/');
  68. const targetSegment = segments[2];
  69. //const numberPart = targetSegment.match(/\d+$/)?.[0];
  70. let num = ref(0);
  71. let articleId;
  72. let pageId;
  73. //通过导航路径反向查询导航id
  74. const getRouteId = await requestDataPromise('/web/getWebsiteRoute', {
  75. method: 'GET',
  76. query: {
  77. 'foot_pinyin': targetSegment,
  78. },
  79. });
  80. if (getRouteId.code == 200) {
  81. articleId = getRouteId.data.id;
  82. pageId = getRouteId.data.id;
  83. } else {
  84. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  85. console.log("错误位置:通过url路径查询导航池id")
  86. console.log("后端错误反馈:", getRouteId.message)
  87. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  88. }
  89. //1.页面依赖 end ---------------------------------------->
  90. //2.页面数据 start ---------------------------------------->
  91. //广告列表
  92. const adList = ref([]);
  93. let adImg1 = ref([]);
  94. let adImg2 = ref([]);
  95. async function getAdData() {
  96. const adData = await requestDataPromise('/web/getWebsiteAdvertisement', { method: 'GET', query: { 'ad_tag': 'PAGE' } });
  97. adList.value = adData.data;
  98. if (adData.code == 200) {
  99. for (let item of adData.data) {
  100. if (item.ad_tag == 'PAGE_0001') {
  101. adImg1.value = item;
  102. }
  103. if (item.ad_tag == 'PAGE_0002') {
  104. adImg2.value = item;
  105. }
  106. }
  107. } else {
  108. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  109. console.log("错误位置:获取详情页广告列表")
  110. console.log("后端错误反馈:", adData.message)
  111. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  112. }
  113. }
  114. getAdData();
  115. const newsDetail = ref({})
  116. const bottomMenu = ref([]);
  117. async function getPageData() {
  118. const mkdata = await requestDataPromise('/web/getWebsiteFooterCategoryInfo', {
  119. method: 'GET',
  120. query: {
  121. 'fcat_id': articleId,
  122. 'type': 0,
  123. },
  124. });
  125. if (mkdata.code == 200) {
  126. newsDetail.value = mkdata.data;
  127. }
  128. }
  129. getPageData();
  130. async function getPageMenu() {
  131. const mkdata = await requestDataPromise('/web/getWebsiteFooterCategory', {
  132. method: 'GET',
  133. query: {},
  134. });
  135. if (mkdata.code == 200) {
  136. bottomMenu.value = mkdata.data;
  137. mkdata.data.forEach((item, index) => {
  138. if (item.id == articleId) {
  139. num.value = index;
  140. }
  141. });
  142. }
  143. }
  144. getPageMenu();
  145. //2.页面数据 end ---------------------------------------->
  146. //4.设置seo信息 start---------------------------------------->
  147. //4.1 设置seo信息
  148. const setData = await requestDataPromise('/web/getWebsiteFootInfo', {
  149. method: 'GET',
  150. query: {},
  151. });
  152. let seoTitle = setData.data.website_head.title;
  153. let seoDescription = setData.data.website_head.description;
  154. let seoKeywords = setData.data.website_head.keywords;
  155. let seoSuffix = setData.data.website_head.suffix;
  156. let seoName = setData.data.website_head.website_name;
  157. useSeoMeta({
  158. title: seoTitle + "_" + seoSuffix,
  159. meta: [
  160. { name: 'description', content: seoDescription + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
  161. { name: 'keywords', content: seoKeywords + "_" + seoName + "_" + seoSuffix, tagPriority: 10 }
  162. ]
  163. });
  164. //4.设置seo信息 end---------------------------------------->
  165. onMounted(async () => {
  166. //从客户端获取行政职能部门 加快打开速度
  167. const { $webUrl, $CwebUrl } = useNuxtApp();
  168. //广告1
  169. let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=nzgxw_page_0001`
  170. const responseAd1 = await fetch(url, {
  171. headers: {
  172. 'Content-Type': 'application/json',
  173. 'Userurl': $CwebUrl,
  174. 'Origin': $CwebUrl
  175. }
  176. });
  177. const resultAd1 = await responseAd1.json();
  178. adImg1.value = resultAd1.data[0];
  179. //广告2
  180. let url2 = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=nzgxw_page_0002`
  181. const responseAd2 = await fetch(url2, {
  182. headers: {
  183. 'Content-Type': 'application/json',
  184. 'Userurl': $CwebUrl,
  185. 'Origin': $CwebUrl
  186. }
  187. });
  188. const resultAd2 = await responseAd2.json();
  189. adImg2.value = resultAd2.data[0];
  190. })
  191. </script>
  192. <style lang="less" scoped>
  193. @import '@/assets/css/about.less';
  194. </style>